package bfs

import (
	"bytes"
	"compress/gzip"
	"fmt"
	"github.com/elazarl/go-bindata-assetfs"
	"io"
	"os"
	"strings"
)

func bindata_read(data []byte, name string) ([]byte, error) {
	gz, err := gzip.NewReader(bytes.NewBuffer(data))
	if err != nil {
		return nil, fmt.Errorf("Read %q: %v", name, err)
	}

	var buf bytes.Buffer
	_, err = io.Copy(&buf, gz)
	gz.Close()

	if err != nil {
		return nil, fmt.Errorf("Read %q: %v", name, err)
	}

	return buf.Bytes(), nil
}

var _res_example_cue = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xa4\x91\x31\x4f\xc3\x30\x10\x85\xe7\xf8\x57\x58\xed\xc6\x90\x1f\x90\x11\xa9\x12\x03\x03\x82\x11\x75\x70\xe3\xa3\x89\x64\x7c\xd6\xf9\x52\x09\x01\xff\x1d\xdd\xc5\xb5\x4c\xe8\x46\xc6\xa7\x7b\xef\x7d\x2f\xde\x1f\xa2\x7f\xc2\x39\xf2\x60\x3f\x4d\x37\x61\xe6\xc1\xca\x97\x99\xe6\x78\x36\x5d\x42\xda\x2a\x84\x8c\x23\x86\xa1\x28\xf6\xcb\xde\xed\x26\xe6\xb4\x33\xdf\xc6\xec\x1f\xd1\xf9\x7b\x17\x5c\x1c\x81\x34\x33\x03\x5d\x80\xf2\x60\x5f\xfb\xbe\x5f\x2d\x47\xd3\x25\x97\xb3\xb4\x4d\xe0\xbc\x1c\x9e\x10\x83\x24\xbd\xb9\x90\xc1\x74\x10\x7d\x12\xaa\x62\xab\x94\x47\xed\x78\x01\xba\xcc\x23\x68\xfc\x99\x70\x49\x2b\x61\x03\x19\xdd\x3b\x54\xf1\x06\x7a\xab\xd2\x12\x6e\xdc\x06\x74\xfe\x54\x77\xfc\x9a\xa5\x0c\xcf\xb8\x70\x59\x08\x91\xe9\xa3\xc5\xad\x2b\xf3\x15\xf4\x4f\x57\x11\x24\xe9\x20\xf6\xff\xbd\x81\xe6\x3c\x30\x27\x4d\x20\x45\x13\x96\x02\xb2\x9a\x0b\x72\xa5\xda\x1e\x5c\x7f\xeb\x76\x50\xbd\x69\x48\xa5\x70\xd2\x3e\xad\xfd\x09\x00\x00\xff\xff\x01\x0e\x67\xdc\x46\x02\x00\x00")

func res_example_cue() ([]byte, error) {
	return bindata_read(
		_res_example_cue,
		"res/example.cue",
	)
}

var _res_index_html = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xb2\xc9\x28\xc9\xcd\xb1\xe3\xe2\xb2\x49\xca\x4f\xa9\xb4\xe3\xca\x48\xcd\xc9\xc9\x57\x28\xcf\x2f\xca\x49\x51\xe4\xb2\xd1\x87\x08\xda\xe8\x83\x15\x01\x02\x00\x00\xff\xff\xb4\xc5\xa4\x5d\x2b\x00\x00\x00")

func res_index_html() ([]byte, error) {
	return bindata_read(
		_res_index_html,
		"res/index.html",
	)
}

// Asset loads and returns the asset for the given name.
// It returns an error if the asset could not be found or
// could not be loaded.
func Asset(name string) ([]byte, error) {
	cannonicalName := strings.Replace(name, "\\", "/", -1)
	if f, ok := _bindata[cannonicalName]; ok {
		return f()
	}
	return nil, fmt.Errorf("Asset %s not found", name)
}

// AssetNames returns the names of the assets.
func AssetNames() []string {
	names := make([]string, 0, len(_bindata))
	for name := range _bindata {
		names = append(names, name)
	}
	return names
}

// _bindata is a table, holding each asset generator, mapped to its name.
var _bindata = map[string]func() ([]byte, error){
	"res/example.cue": res_example_cue,
	"res/index.html":  res_index_html,
}

// AssetDir returns the file names below a certain
// directory embedded in the file by go-bindata.
// For example if you run go-bindata on data/... and data contains the
// following hierarchy:
//     data/
//       foo.txt
//       img/
//         a.png
//         b.png
// then AssetDir("data") would return []string{"foo.txt", "img"}
// AssetDir("data/img") would return []string{"a.png", "b.png"}
// AssetDir("foo.txt") and AssetDir("notexist") would return an error
// AssetDir("") will return []string{"data"}.
func AssetDir(name string) ([]string, error) {
	node := _bintree
	if len(name) != 0 {
		cannonicalName := strings.Replace(name, "\\", "/", -1)
		pathList := strings.Split(cannonicalName, "/")
		for _, p := range pathList {
			node = node.Children[p]
			if node == nil {
				return nil, fmt.Errorf("Asset %s not found", name)
			}
		}
	}
	if node.Func != nil {
		return nil, fmt.Errorf("Asset %s not found", name)
	}
	rv := make([]string, 0, len(node.Children))
	for name := range node.Children {
		rv = append(rv, name)
	}
	return rv, nil
}

type _bintree_t struct {
	Func     func() ([]byte, error)
	Children map[string]*_bintree_t
}

var _bintree = &_bintree_t{nil, map[string]*_bintree_t{
	"res": &_bintree_t{nil, map[string]*_bintree_t{
		"example.cue": &_bintree_t{res_example_cue, map[string]*_bintree_t{}},
		"index.html":  &_bintree_t{res_index_html, map[string]*_bintree_t{}},
	}},
}}

func assetFS() *assetfs.AssetFS {
	assetInfo := func(path string) (os.FileInfo, error) {
		return os.Stat(path)
	}
	for k := range _bintree.Children {
		return &assetfs.AssetFS{Asset: Asset, AssetDir: AssetDir, AssetInfo: assetInfo, Prefix: k}
	}
	panic("unreachable")
}
